<template>
    <div>
        <Login v-if="!isLogin" @login="loginHandler"></Login>
        <Home v-else :username="username" :password="password"></Home>
    </div>
</template>

<script>
    import Login from './login'
    import Home from './home'

    export default {
        name: "index",
        components: {
            Login,
            Home
        },
        data() {
            return {
                isLogin: false,
                username: '',
                password: ''
            }
        },
        methods:{
            loginHandler(username, password) {
                this.isLogin = true
                this.username = username
                this.password = password
            }
        }

    }
</script>

<style scoped>

</style>
